#!/bin/bash
tool_dir=/opt/lightdb/deploy
tool_name=multiplex_deploy_x86_64

echo "tool dir : $tool_dir"
echo "tool name: $tool_name"

current_dir=$(pwd)
echo "current_dir : $current_dir"

last_folder=$(basename "$(pwd)")
echo "最后一个文件夹名称: $last_folder"

if [ -d "$tool_dir" ]; then
    echo "Act process: $tool_name"
    cd "$tool_dir"

    current_dir_2=$(pwd)
    echo "current_dir_2:$current_dir_2"

    if [ -f "$tool_dir/$tool_name" ]; then
	    deply_command="$tool_dir/$tool_name -service_name=$last_folder"
	    echo "deploy command:$deply_command"
	    $deply_command
	    echo "deploy done."
    fi
fi

cd $current_dir

echo "exit"
